This invention relates to a method of sharing a communication port between two applications. More particularly, this invention relates to a method of automatically relinquishing control of a serial communication port by an application so as to allow another application to have control over it.
Handheld personal computers (H/PC) have become very popular as personal organizers. These H/PCs are generally small and light, making them very handy for a mobile user. One of the applications on such H/PCs is the appointment application. This appointment application allows a user to enter and maintain information regarding meetings and things to do. Such information requires constant updating throughout the day. The information is usually entered using a keyboard on a H/PC. Although such a keyboard is adequate for entering small amount of data, it is an impediment to the quick entry of large amounts of data. The small size QWERTY keyboard on such a H/PC does not allow typical typing speeds achievable on a standard size QWERTY keyboard. As such, to ease the entry of large amount of data, the manufacturers of such a H/PC device usually provide an accompanying appointment application that runs on a desktop personal computer (PC). The standard size keyboard on the desktop PC then allows quick entry of data. Once the data is entered, the data can be downloaded onto the H/PC. Such a process is known as synchronization. To allow synchronization, the H/PC is connected via its serial communication port to the desktop PC by a synchronization cable. Software on both the H/PC and desktop PC communicate via the synchronization cable to synchronize data on both ends. After synchronization, the same data is maintained on both the desktop PC and the H/PC. Other data which can be easily entered on the desktop PC such as a word processing document can also be downloaded onto the H/PC through this synchronization cable. A user typically carries out such a synchronization process several times a day. Due to the relatively small size and cost constraint of a H/PC, usually only a single serial communication port is made available on the H/PC. This serial communication port which can also be used for communicating with other external devices will have to be shared. As such, when switching between using the serial port for communication with an external device and using the port for synchronization, a user would have to perform extraneous steps to facilitate such switching. The user would have to disconnect the external device and connect the synchronization cable to the serial communication port of the H/PC. The user will also have to cause the application using the external device to relinquish control of the serial communication port to allow a synchronization software on the H/PC to acquire control of the serial communication port. The user performs such a step by either manually activating a suitable command in the application or manually shutting down the application entirely. Similarly, when synchronization is complete, the user will have to reconnect the external device and manually cause the associated application to acquire control of the serial communication port once again to resume use of the port to communicate with the external device. For a user who needs to perform synchronization regularly, such manual steps are cumbersome.
From the foregoing, the prior art therefore has a need for a method of automatically allowing the application software to relinquish and reacquire control of a serial communication port when switching between using an application for communicating with an external device and performing synchronization.
In accordance with a preferred embodiment, the present invention provides a method for controlling a communication port of a computer by a first application running on the computer. The method involves the first application acquiring control of the communication port. Thereafter, the first application uses a first cable connected to the communication port for interfacing with an external device. While interfacing with the external device, the first application looks for an identification signal on the communication port. The first application relinquishes control of the communication port when the identification signal is detected so that a second application can use the communication port.
Preferably, the first application also looks for the removal of the identification signal on the communication port. When this condition occurs, the first application can resume control and use of the communication port to continue interfacing with the external device.